package com.lau.proxy;

/**
 * Created by liutf on 2016/7/19.
 */
public class TestUser {

    public static void main(String[] args) {

        //静态代理
        UserStaticProxy userProxy = new UserStaticProxy(new UserServiceImpl());
        userProxy.queryUser();

        //动态代理
        UserDynProxy userDynProxy = new UserDynProxy();
        UserService userService = (UserService) userDynProxy.bind(new UserServiceImpl());
        userService.queryUser();

//        BookServiceImpl bookService = (BookServiceImpl) userDynProxy.bind(new BookServiceImpl());
//        bookService.saveBook();

        UserCglibProxy cglibProxy = new UserCglibProxy();
        BookServiceImpl bookService = (BookServiceImpl) cglibProxy.getInstance(BookServiceImpl.class);
        bookService.saveBook();

    }

}
